package com.yl.ifanr.service;

import java.util.List;
import android.content.Context;
import android.util.Log;

import com.yl.ifanr.db.RssDaoimpl;
import com.yl.ifanr.db.RssItemBean;
import com.yl.ifanr.service.BaseService;
import com.yl.rss.RssFeed;
import com.yl.rss.RssLoad;
import com.yl.util.Constants;

public class RssServiceimpl extends BaseService{
	private static final String TAG = "RssServiceimpl";
	private RssFeed feed = null;
	private List<RssItemBean> itemList;
	private RssDaoimpl rssDaoimpl;
	public RssServiceimpl(Context context){
		super(context);
		rssDaoimpl = new RssDaoimpl(context);
	}
	@Override
	public boolean updateData() {
		try {
			boolean result = false;
			RssLoad rssload = new RssLoad();
			feed = rssload.getFeed(Constants.RSS_URL);
			itemList = feed.getAllItems();
			result = rssDaoimpl.insert(itemList);
			return result;
		}catch(Exception e){
			Log.e("RssServiceimpl:", e.getMessage());
			return false;
		}
		
		
	}
}
